<!-- inclusion barbare des css ... -->
<link rel="stylesheet" type="text/css" media="screen" href="/sfAdminThemejRollerPlugin/css/jquery/redmond/jquery-ui.custom.css" /> 
<link rel="stylesheet" type="text/css" media="screen" href="/sfAdminThemejRollerPlugin/css/jroller.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/sfAdminThemejRollerPlugin/css/fg.menu.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/sfAdminThemejRollerPlugin/css/fg.buttons.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/sfAdminThemejRollerPlugin/css/ui.selectmenu.css" />

<!-- include du javascript pour la grid de base -->
<?php
use_javascript('jqgrid/jquery.jqGrid.min.js');
?>

<!-- include du javascript a la fois pour les UI de JQuery mais aussi pour GMAP -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="/js/contact_grid.js"></script>
<script type="text/javascript">
    // placer les tabs avec jquery ui
    $(document).ready(function() {
        $("#sidebarContact").tabs();
        $("#informationsContact").tabs();
        $("#inscriptionsContact").tabs();
        $('#ajoutRapide').tabs();
    });


</script>

<caption class="fg-toolbar ui-widget-header ui-corner-top">
    <div id="sf_admin_filters_buttons" class="fg-buttonset fg-buttonset-multi ui-state-default">
        <a href="<?php echo url_for('contact/edit?id='.$contact->getId()) ?>" id="sf_admin_filter_button" class="fg-button ui-state-default fg-button-icon-left ui-corner-left sf_button-toggleable">Editer la fiche</a>
        <a href="<?php echo url_for('contact/index') ?>" class="fg-button ui-state-default fg-button-icon-left ui-corner-right">Retour à la liste</a>
    </div>
    <h1 style="margin-left: 1%;">
        Fiche de <?php echo $contact->getPrenom()." ".$contact->getNom()?>
    </h1>
    <span style="margin-left: 10px;"><?php echo html_entity_decode($contact->aUnCadeauARecevoir()) ?></span>
</caption>

<div id="sf_admin_container" >
    <div id="informationsContact">
        <ul>
            <li class="horizontalTabs"><a href="#ficheContact"><span>Fiche</span></a></li>
            <li class="horizontalTabs"><a href="#inscriptionsContact"><span>Inscriptions</span></a></li>
        </ul>
        <!-- DEBUT INFORMATIONS PRINCIPALES CONTACT -->
        <div id="ficheContact">
            <table id="tableauContact" class="ui-widget ui-widget-content detailsContact">
                <tbody>
                    <tr class="ui-widget-header">
                        <th colspan="4" style="text-align: left;">
                            <h1>D&eacute;tails de <?php echo $contact->getPrenom()." ".$contact->getNom(); ?></h1>
                        </th>
                    </tr>
                    <tr>
                        <th>Nom</th>
                        <td><?php echo $contact->getNom() ?></td>
                        <th>Prenom</th>
                        <td><?php echo $contact->getPrenom() ?></td>
                    </tr>
                    <tr>
                        <th>Date de naissance</th>
                        <td>
                            <?php
                            if (!is_null($contact->getDateDeNaissance())) {
                                $date = explode("-",$contact->getDateDeNaissance());
                                echo $date[2]."-".$date[1]."-".$date[0];
                            }
                            ?>
                        </td>
                        <th>Code</th>
                        <td>
                            <?php
                            $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                            if (!is_null($contact->getCode())) {
                                $valeur = $contact->getCode();
                                if (empty($valeur)) {
                                    $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                }
                            }

                            echo $valeur;
                            ?>
                        </td>
                    </tr>
                    <tr>
                        <th>Newsletter par mailing</th>
                        <td>
                            <?php
                            $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                            if (!is_null($contact->getEnvoyerNewsParMail())) {
                                $valeur = $contact->getEnvoyerNewsParMail() ? 'oui' : 'non';
                            }

                            echo $valeur;
                            ?>
                        </td>
                        <th>Newsletter par lettre</th>
                        <td>
                            <?php
                            $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                            if (!is_null($contact->getEnvoyerNewsParLettre())) {
                                $valeur = $contact->getEnvoyerNewsParLettre() ? 'oui' : 'non';
                            }

                            echo $valeur;
                            ?>
                        </td>
                    </tr>
                    <tr>
                        <th>Origine de l'information</th>
                        <td>
                            <?php
                            $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                            if (!is_null($contact->getOrigineInfo())) {
                                $valeur = $contact->getOrigineInfo();
                                if (empty($valeur)) {
                                    $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                }
                            }
                            echo $valeur;
                            ?>
                        </td>
                        <th>&nbsp;</th>
                        <td>&nbsp;</td>
                    </tr>
                    <tr class="ui-widget-header">
                        <th colspan="4" style="text-align: left;">
                            Commentaire
                        </th>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <?php
                            $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                            if (!is_null($contact->getCommentaire())) {
                                $valeur = $contact->getCommentaire();
                                if (empty($valeur)) {
                                    $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                }
                            }
                            echo $valeur;
                            ?>
                        </td>
                    </tr>
                    <tr>
                <table class="ui-widget ui-widget-content detailsContact">
                    <tbody>
                        <tr class="ui-widget-header">
                            <th colspan="4" style="text-align: left;">Rôle</th>
                        </tr>
                        <tr>
                            <th>Est animateur</th>
                            <td>
                                <?php
                                $valeur = "<span class=\"nonSpecifie\">Non</span>";
                                if (!is_null($contact->getAnimateur())) {
                                    $valeur = $contact->getAnimateur();
                                    if (empty($valeur)) {
                                        $valeur = "<span class=\"nonSpecifie\">Non</span>";
                                    }
                                }
                                echo $valeur;
                                ?>
                            </td>
                            <th>Est artiste</th>
                            <td>
                                <?php
                                $valeur = "<span class=\"nonSpecifie\">Non</span>";
                                if (!is_null($contact->getArtiste())) {
                                    $valeur = $contact->getArtiste();
                                    if (empty($valeur)) {
                                        $valeur = "<span class=\"nonSpecifie\">Non</span>";
                                    }
                                }
                                echo $valeur;
                                ?>
                            </td>
                        </tr>
                    <th>Membre du staff</th>
                    <td>
                        <?php
                        $valeur = "<span class=\"nonSpecifie\">Non</span>";
                        if (!is_null($contact->getStaff())) {
                            $valeur = $contact->getStaff();
                            if (empty($valeur)) {
                                $valeur = "<span class=\"nonSpecifie\">Non</span>";
                            }
                        }
                        echo $valeur;
                        ?>
                    </td>
                    <th>Est externe</th>
                    <td>
                        <?php
                        $valeur = "<span class=\"nonSpecifie\">Non</span>";
                        if (!is_null($contact->getExterne())) {
                            $valeur = $contact->getExterne();
                            if (empty($valeur)) {
                                $valeur = "<span class=\"nonSpecifie\">Non</span>";
                            }
                        }
                        echo $valeur;
                        ?>
                    </td>
                    </tr>
                </table>
                </tr>
                <tr>
                <table class="ui-widget ui-widget-content detailsContact">
                    <tbody>
                        <tr class="ui-widget-header">
                            <th colspan="4">Adresse</th>
                        </tr>
                        <tr>
                            <th>Numero</th>
                            <td style="width: 25%">
                                <?php
                                $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                if (!is_null($contact->getNumero())) {
                                    $valeur = $contact->getNumero();
                                    if (empty($valeur)) {
                                        $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                    }
                                }
                                echo $valeur;
                                ?>
                            </td>
                            <th>Rue</th>
                            <td>
                                <?php
                                $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                if (!is_null($contact->getRue())) {
                                    $valeur = $contact->getRue();
                                    if (empty($valeur)) {
                                        $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                    }
                                }
                                echo $valeur;
                                ?>
                            </td>
                        </tr>
                        <tr>
                            <th>Code postal</th>
                            <td>
                                <?php
                                $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                if (!is_null($contact->getCodePostal())) {
                                    $valeur = $contact->getCodePostal();
                                    if (empty($valeur)) {
                                        $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                    }
                                }
                                echo $valeur;
                                ?>
                            </td>
                            <th>Localit&eacute;</th>
                            <td>
                                <?php
                                $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                if (!is_null($contact->getLocalite())) {
                                    $valeur = $contact->getLocalite();
                                    if (empty($valeur)) {
                                        $valeur = "<span class=\"nonSpecifie\">Non sp&eacute;cifi&eacute;</span>";
                                    }
                                }
                                echo $valeur;
                                ?>
                            </td>
                        </tr>
                </table>
                </tr>
                <tr>
                    <!-- Debut Mails -->
                <table id="tableauContact" class="ui-widget ui-widget-content detailsContact">
                    <tbody>
                        <tr class="ui-widget-header">
                            <th colspan="2" style="text-align: left;">Adresses e-mail</th>
                        </tr>
                        <tr>
                            <th>Mails</th>
                            <th>Commentaire</th>
                        </tr>
                        <tr>
                            <?php
                            foreach($personneMails as $mails) {
                                ?>
                            <td>
                                    <?php echo $mails->getValeur(); ?>
                            </td>
                            <td>
                                    <?php echo $mails->getCommentaire(); ?>
                            </td>
                                <?php } ?>
                        </tr>
                </table>
                <!-- Fin Mails -->
                </tr>
                <tr>
                    <!-- Debut Telephone -->
                <table id="tableauContact" class="ui-widget ui-widget-content detailsContact">
                    <tbody>
                        <tr class="ui-widget-header">
                            <th colspan="2" style="text-align: left;">T&eacute;l&eacute;phones</th>
                        </tr>
                        <tr>
                            <th>Num&eacute;ros</th>
                            <th>Commentaire</th>
                        </tr>
                        <tr>
                            <?php
                            foreach($personneTelephone as $telephone) {
                                ?>
                            <td>
                                    <?php echo $telephone->getValeur(); ?>
                            </td>
                            <td>
                                    <?php echo $telephone->getCommentaire(); ?>
                            </td>
                                <?php } ?>
                        </tr>
                </table>
                <!-- Fin Telephone -->
                </tr>
                <tr>
                    <!-- Debut Fax -->
                <table id="tableauContact" class="ui-widget ui-widget-content detailsContact">
                    <tbody>
                        <tr class="ui-widget-header">
                            <th colspan="2" style="text-align: left;">Fax</th>
                        </tr>
                        <tr>
                            <th>Fax</th>
                            <th>Commentaire</th>
                        </tr>
                        <tr>
                            <?php
                            foreach ($personneFax as $fax) {
                                ?>
                            <td>
                                    <?php echo $fax->getValeur(); ?>
                            </td>
                            <td>
                                    <?php echo $fax->getCommentaire(); ?>
                            </td>

                                <?php } ?>
                        </tr>
                </table>
                <!-- Fin Fax -->
                </tr>
                <tr>
                    <!-- Debut Cpt Banque -->
                <table id="tableauContact" class="ui-widget ui-widget-content detailsContact">
                    <tbody>
                        <tr class="ui-widget-header">
                            <th colspan="2" style="text-align: left;">Comptes en banque</th>
                        </tr>
                        <tr>
                            <th>Comptes en banque</th>
                            <th>Commentaire</th>
                        </tr>
                        <tr>
                            <?php
                            foreach($personneCptBanque as $banque) {
                                ?>
                            <td>
                                    <?php echo $banque->getValeur(); ?>
                            </td>
                            <td>
                                    <?php echo $banque->getCommentaire(); ?>
                            </td>
                                <?php } ?>
                </table>
                <!-- Fin cpt Banque -->
                </tr>
                <tr>
                <table class="ui-widget ui-widget-content detailsContact">
                    <tbody>
                        <tr class="ui-widget-header">
                            <th colspan="4">G&eacute;olocalisation</th>
                        </tr>
                        <tr>
                            <td>
                                <div id="map_canvas" style="width: 100%; height: 600px;">
                                    <script type="text/javascript">
                                        initialize(<?php echo "'".$contact->getNumero()." ".$contact->getRue()." ".$contact->getCodePostal()." ".$contact->getLocalite()." ".$contact->getPays()."'"; ?>);
                                    </script>
                                </div>
                            </td>
                        </tr>
                </table>
                </tr>
            </table>
            <br />
            <table id="tableauContact" class="ui-widget ui-widget-content detailsContact">
                <tbody>
                    <tr class="ui-widget-header">
                        <th colspan="4" style="text-align: left;">Activit&eacute;s</th>
                    </tr>
                    <tr>
                        <td>
                            <!-- communications -->
                            <table id="ins_abonnement"></table>
                            <script type="text/javascript">getAbonnements("#ins_abonnement",<?php echo "'".$contact->getId()."'"; ?>,5)</script>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <!-- inscriptions stages -->
                            <table id="ins_stage"></table>
                            <script type="text/javascript">getInsStages("#ins_stage",<?php echo "'".$contact->getId()."'"; ?>,"contact_ins_stage","Inscriptions stages",5)</script>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <!-- inscriptions ateliers -->
                            <table id="ins_atelier"></table>
                            <script type="text/javascript">getInsAteliers("#ins_atelier",<?php echo "'".$contact->getId()."'"; ?>,"contact_ins_atelier","Inscriptions ateliers",5)</script>

                        </td>
                    </tr>
                    <tr>
                        <td>
                            <!-- inscriptions reservations -->
                            <table id="ins_reservation"></table>
                            <script type="text/javascript">getReservations("#ins_reservation",<?php echo "'".$contact->getId()."'"; ?>,5)</script>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <!-- locations -->
                            <table id="ins_location"></table>
                            <script type="text/javascript">getLocations("#ins_location",<?php echo "'".$contact->getId()."'"; ?>,5)</script>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <!-- parrains -->
                            <table id="parrain"></table>
                            <script type="text/javascript">getParrains("#parrain",<?php echo "'".$contact->getId()."'"; ?>,5)</script>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <!-- inscriptions newsletters -->
                            <table id="ins_newsletter"></table>
                            <script type="text/javascript">getNewsletters("#ins_newsletter",<?php echo "'".$contact->getId()."'"; ?>,5)</script>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <!-- communications -->
                            <table id="ins_communication"></table>
                            <script type="text/javascript">getCommunications("#ins_communication",<?php echo "'".$contact->getId()."'"; ?>,5)</script>
                        </td>
                    </tr>
            </table>
            </table>
        </div>
        <!-- Fin Coordonnees -->

        <!-- debut liaisons -->
        <div id="inscriptionsContact">
            <!-- ajout d'une seconde ligne de tabs -->
            <ul>
                <li class="horizontalTabs"><a href="#dInsAteliers"><span>Ateliers</span></a></li>
                <li class="horizontalTabs"><a href="#dInsCommunications"><span>Communications</span></a></li>
                <li class="horizontalTabs"><a href="#dInsNewsletters"><span>Newsletters</span></a></li>
                <li class="horizontalTabs"><a href="#dInsLocations"><span>Locations</span></a></li>
                <li class="horizontalTabs"><a href="#dInsReservations"><span>R&eacute;servations</span></a></li>
                <li class="horizontalTabs"><a href="#dInsStages"><span>Stages</span></a></li>
                <li class="horizontalTabs"><a href="#dInsAbos"><span>Abonnements</span></a></li>
            </ul>
            <div id="dInsAteliers">
                <table id="tInsAteliers"></table>
                <script type="text/javascript">
                    getToutesInsAteliers("#tInsAteliers", <?php echo "'".$contact->getId()."'"; ?>)
                </script>
            </div>
            <div id="dInsCommunications">
                <table id="tInsCommunications"></table>
                <script type="text/javascript">
                    getToutesCommunications("#tInsCommunications", <?php echo "'".$contact->getId()."'"; ?>)
                </script>
            </div>
            <div id="dInsNewsletters">
                <table id="tInsNewsletters"></table>
                <script type="text/javascript">
                    getToutesNewsletters("#tInsNewsletters", <?php echo "'".$contact->getId()."'"; ?>)
                </script>
            </div>
            <div id="dInsLocations">
                <table id="tInsLocations"></table>
                <script type="text/javascript">
                    getToutesLocations("#tInsLocations", <?php echo "'".$contact->getId()."'"; ?>)
                </script>
            </div>
            <div id="dInsReservations">
                <table id="tInsReservations"></table>
                <script type="text/javascript">
                    getToutesReservations("#tInsReservations", <?php echo "'".$contact->getId()."'"; ?>)
                </script>
            </div>
            <div id="dInsStages">
                <table id="tInsStages"></table>
                <script type="text/javascript">
                    getToutesInsStages("#tInsStages", <?php echo "'".$contact->getId()."'"; ?>)
                </script>
            </div>
            <div id="dInsAbos">
                <table id="tInsAbos"></table>
                <script type="text/javascript">
                    getTousAbonnements("#tInsAbos", <?php echo "'".$contact->getId()."'"; ?>)
                </script>
            </div>
        </div>
        <!-- Fin Reservation -->
        <!-- FIN INFOS PRINCIPALES SUR CONTACT 
        -->
    </div>
    <div id="ajoutRapide">
        <ul>
            <li class="horizontalTabs"><a href="#ajoutRapideBoutons"><span>Ajout rapide</span></a></li>
        </ul>
        <!-- Debut ajouts rapides -->
        <div id="ajoutsRapideBoutons">
            <br />
            <input type="button" onclick="location.href='<?php echo url_for("communication/new?id=".$contact->getId()); ?>'" class="fg-button ui-state-default fg-button-icon-left ui-corner-all ui-state-active sf_button-toggleable" style="width: 100%;" value="Communication"/>
            <br /><br />
            <input type="button" onclick="location.href='<?php echo url_for("ins_abonnement/new?id=".$contact->getId()); ?>'" class="fg-button ui-state-default fg-button-icon-left ui-corner-all ui-state-active sf_button-toggleable" style="width: 100%;" value="Abonnement"/>
            <br /><br />
            <input type="button" onclick="location.href='<?php echo url_for("ins_atelier/new?id=".$contact->getId()); ?>'" class="fg-button ui-state-default fg-button-icon-left ui-corner-all ui-state-active sf_button-toggleable" style="width: 100%;" value="Atelier"/>
            <br /><br/>
            <input type="button" onclick="location.href='<?php echo url_for("ins_stage/new?id=".$contact->getId()); ?>'" class="fg-button ui-state-default fg-button-icon-left ui-corner-all ui-state-active sf_button-toggleable" style="width: 100%;" value="Stage"/>
            <br /><br/>
            <input type="button" onclick="location.href='<?php echo url_for("location/new?id=".$contact->getId()); ?>'" class="fg-button ui-state-default fg-button-icon-left ui-corner-all ui-state-active sf_button-toggleable" style="width: 100%;" value="Location"/>
            <br /><br/>
            <input type="button" onclick="location.href='<?php echo url_for("reservation/new?id=".$contact->getId()); ?>'" class="fg-button ui-state-default fg-button-icon-left ui-corner-all ui-state-active sf_button-toggleable" style="width: 100%;" value="Réservation"/>
        </div>
        <!-- Fin ajouts rapides -->
    </div>
</div>